package goods;

import java.util.List;
import java.util.stream.Collectors;

public class Cart {

    /*商品总价*/
    private double total;

    List<Goods> goodsList;

    public List<Goods> getGoodsList() {
        return goodsList;
    }

    public void setGoodsList(List<Goods> goodsList) {
        this.goodsList = goodsList;
    }

    public double getTotal() {
        return this.total = goodsList.stream().map(Goods::getSubtotal).reduce(0.0,Double::sum);
    }

}
